<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!--导入struts2标签库-->



<html>
<head>
  <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
  <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <title>登录页</title>

  <style>
    .sign-up-card{
      /*width:400px;*/
      /*margin: 60px auto;*/
      padding: 30px 50px 30px;
      background-color: rgba(255,255,255,0.9);
      border-radius: 4px;
      box-shadow: 0 0 10px rgba(0,0,0,.1);
      vertical-align: middle;
      display: inline-block;
      height:480px;
    }

    .form-group input{
      margin:10px 0;
    }

    /*清空tab的标签样式*/
    .nav-tabs > li.active > a,
    .nav-tabs > li.active > a:hover,
    .nav-tabs > li.active > a:focus{
      border-left:none;
      border-right:none;
      border-top:none;
      background-color: transparent;
      border-bottom-color: #1b6d85;
      border-bottom-width: 2px;
    }

  </style>

</head>
<body background="image/night.jpg" style="background-size: cover">

<%
    String userNameOrPassword;
    if((String) session.getAttribute("userNameOrPassword")!=null)
    {
      userNameOrPassword = (String) session.getAttribute("userNameOrPassword");
      session.setAttribute("userNameOrPassword","");
    }
    else
        userNameOrPassword="";

%>

<div class="container" style="margin-top: 80px">

  <div class="row col-md-4 col-md-offset-4 sign-up-card" style="text-align: center">
    <img src="image/doubanjiang.png" class="img-rounded" style="width:210px;height:150px"><br>
    <div style="text-align: center">
      <ul class="nav nav-tabs">
        <li class="active">
          <a href="#panel-user" data-toggle="tab">登录</a>
        </li>
        <li>
          <a href="#panel-register" data-toggle="tab">注册</a>
        </li>
      </ul>

      <!--登录页卡-->
      <div class="tab-content column col-md-12" style="margin-top: 40px">
        <div id="panel-user" class="tab-pane fade in active">
          <form class="form-group" action="loginAction.action" method="post">
            <input type="text" required="required" id="user-name" class="form-control" placeholder="用户名" name="user_name">
            <input type="password" required="required" id="user-pwd" id="name" class="form-control" placeholder="密码" name="user_password">
            <input type="submit"  class="btn btn-default" value="登录">
            <input type="reset"  class="btn btn-default" value="重置">
          </form>
        </div>

        <!--注册页卡-->
        <div id="panel-register" class="tab-pane fade">
          <form class="form-group" action="registerAction.action"  method="post">
            <input type="text" pattern="[A-Za-z0-9]{3,9}" required="required" id="register-name" class="form-control" placeholder="用户名(3-9个字母数字组合)" name="user_name">
            <input type="password" pattern="[A-Za-z0-9]{3,9}" required="required" id="registerpwd" class="form-control" placeholder="密码(3-15个字母数字组合)" name="user_password">
            <input type="submit"  class="btn btn-default" value="注册">
            <input type="reset"  class="btn btn-default" value="重置">
          </form>
        </div>
        <%--<s:fielderror fieldName="user_nameOrPassword" ></s:fielderror>--%>
        <div><span style="color: red"><%= userNameOrPassword%></span></div>
      </div>
    </div>
  </div>

</div>
</body>

<script language="javascript">
//    function registerCheck()
//    {
//        var userName = document.getElementById("register-name");
//        var reg = [A-Za-z0-9]{3,9}
//        if(reg.test(userName))
//            return true;
//        else
//            return false;
//    }
</script>

</html>

